package com.reggie.module.controller;

import com.reggie.common.ResultResponseVo;
import com.reggie.module.entity.dto.userDto.LoginDto;
import com.reggie.module.service.UserService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author 早睡蛋
 * @Date 2022/9/26 20:33:49
 * @Desc:
 */
@RestController
@RequestMapping("/login")
@CrossOrigin
@Slf4j
@Api(tags = "用户登录管理模块")
public class LoginController {

    @Autowired
    private UserService userService;


    /**
     * 用户登录/注册
     *
     * @param loginDto
     * @return
     */
    @PostMapping("/userLogin")
    public ResultResponseVo login(@RequestBody LoginDto loginDto, HttpServletRequest request) {
        return userService.login(loginDto, request);
    }


}
